<#assign ctx=springMacroRequestContext.contextPath />
<#include "/macro/publicMacro.ftl">
<#import "/macro/pagination.ftl" as Pagination>

<@header title="用户列表">
    <link href="${ctx}/resource/common/css/pagination.css" rel="stylesheet">
    <link href="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.min.css" rel="stylesheet">
</@header>

<@body>
    <h2 class="module-title">用户管理</h2>

    <div class="alert alert-primary" role="alert">
        <form class="form-inline form-margin" action="${ctx}/imUser/list">
            <div class="form-group mb-2">
                <label for="code" class="ml-2">登录码：</label>
                <input type="text" class="form-control" id="code" name="code" value="${imUser.code}">
            </div>
            <div class="form-group mb-2">
                <label for="userName" class="ml-2">用户名：</label>
                <input type="text" class="form-control" id="userName" name="userName" value="${imUser.userName}">
            </div>
            <div class="form-group mb-2">
                <label for="password" class="ml-2">登录密码：</label>
                <input type="text" class="form-control" id="password" name="password" value="${imUser.password}">
            </div>
            <div class="form-group mb-2">
                <label for="terminalTypes" class="ml-2">登录终端：</label>
                <input type="text" class="form-control" id="terminalTypes" name="terminalTypes" value="${imUser.terminalTypes}">
            </div>
            <div class="form-group mb-2">
                <label for="tenantCode" class="ml-2">租户id：</label>
                <input type="text" class="form-control" id="tenantCode" name="tenantCode" value="${imUser.tenantCode}">
            </div>
            <div class="form-group mb-2">
                <label for="departmentCode" class="ml-2">部门编码：</label>
                <input type="text" class="form-control" id="departmentCode" name="departmentCode" value="${imUser.departmentCode}">
            </div>
            <div class="form-group mb-2">
                <label for="mobile" class="ml-2">手机号：</label>
                <input type="text" class="form-control" id="mobile" name="mobile" value="${imUser.mobile}">
            </div>
            <div class="form-group mb-2">
                <label for="headImg" class="ml-2">头像：</label>
                <input type="text" class="form-control" id="headImg" name="headImg" value="${imUser.headImg}">
            </div>
            <div class="form-group mb-2">
                <label for="motto" class="ml-2">座右铭：</label>
                <input type="text" class="form-control" id="motto" name="motto" value="${imUser.motto}">
            </div>
            <div class="form-group mb-2">
                <label for="sex" class="ml-2">性别：</label>
                <input type="text" class="form-control" id="sex" name="sex" value="${imUser.sex}">
            </div>
            <div class="form-group mb-2">
                <label for="enable" class="ml-2">是否可用：</label>
                <input type="text" class="form-control" id="enable" name="enable" value="${imUser.enable}">
            </div>
            <div class="form-group mb-2">
                <label for="token" class="ml-2">无密盾牌：</label>
                <input type="text" class="form-control" id="token" name="token" value="${imUser.token}">
            </div>
            <div class="form-group mb-2">
                <label for="refreshToken" class="ml-2">刷新盾牌：</label>
                <input type="text" class="form-control" id="refreshToken" name="refreshToken" value="${imUser.refreshToken}">
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="startLoginTime" class="ml-2">开始上次登录时间：</label>
                <input type="text" class="form-control" name="startLoginTime" id="startLoginTime" aria-describedby="上次登录时间" placeholder="上次登录时间" value="${(imUser.startLoginTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="endLoginTime" class="ml-2">结束上次登录时间：</label>
                <input type="text" class="form-control" name="endLoginTime" id="endLoginTime" aria-describedby="上次登录时间" placeholder="上次登录时间" value="${(imUser.endLoginTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mb-2">
                <label for="loginErrorNum" class="ml-2">登录失败次数：</label>
                <input type="text" class="form-control" id="loginErrorNum" name="loginErrorNum" value="${imUser.loginErrorNum}">
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="startLockTime" class="ml-2">开始锁定时间：</label>
                <input type="text" class="form-control" name="startLockTime" id="startLockTime" aria-describedby="锁定时间" placeholder="锁定时间" value="${(imUser.startLockTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="endLockTime" class="ml-2">结束锁定时间：</label>
                <input type="text" class="form-control" name="endLockTime" id="endLockTime" aria-describedby="锁定时间" placeholder="锁定时间" value="${(imUser.endLockTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
                <!--  do nothing -->
            <div class="form-group mx-sm-3 mb-2">
                <label for="startUpdateTime" class="ml-2">开始更新时间：</label>
                <input type="text" class="form-control" name="startUpdateTime" id="startUpdateTime" aria-describedby="更新时间" placeholder="更新时间" value="${(imUser.startUpdateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="endUpdateTime" class="ml-2">结束更新时间：</label>
                <input type="text" class="form-control" name="endUpdateTime" id="endUpdateTime" aria-describedby="更新时间" placeholder="更新时间" value="${(imUser.endUpdateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
                <!--  do nothing -->

            <div class="form-group mx-sm-3 mb-2">
                <button type="submit" class="btn btn-primary">查询</button>
            </div>

            <@shiro.hasPermission name="imUser:toAdd">
            <div class="form-group mx-sm-3 mb-2" style="float:right">
                <span style="float:left"><a href="${ctx}/imUser/toAdd">添加数据</a></span>
            </div>
            </@shiro.hasPermission>
        </form>
    </div>

    <div class="table-responsive">
        <table class="table table-striped table-bordered">
            <thead>
                <th>主键</th>
                <th>登录码</th>
                <th>用户名</th>
                <th>登录密码</th>
                <th>登录终端</th>
                <th>租户id</th>
                <th>部门编码</th>
                <th>手机号</th>
                <th>头像</th>
                <th>座右铭</th>
                <th>性别</th>
                <th>是否可用</th>
                <th>无密盾牌</th>
                <th>刷新盾牌</th>
                <th>上次登录时间</th>
                <th>登录失败次数</th>
                <th>锁定时间</th>
                <th></th>
                <th>更新时间</th>
                <th></th>
                <th>操作</th>
            </thead>
            <tbody>
            <#list imUsers.beans as imUser>
                <tr>
                    <th>${imUser.id!}</th>
                    <th>${imUser.code!}</th>
                    <th>${imUser.userName!}</th>
                    <th>${imUser.password!}</th>
                    <th>${imUser.terminalTypes!}</th>
                    <th>${imUser.tenantCode!}</th>
                    <th>${imUser.departmentCode!}</th>
                    <th>${imUser.mobile!}</th>
                    <th>${imUser.headImg!}</th>
                    <th>${imUser.motto!}</th>
                    <th>${imUser.sex!}</th>
                    <th>${imUser.enable!}</th>
                    <th>${imUser.token!}</th>
                    <th>${imUser.refreshToken!}</th>
                    <th>${(imUser.loginTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th>${imUser.loginErrorNum!}</th>
                    <th>${(imUser.lockTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th>${(imUser.createTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th>${(imUser.updateTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th>${(imUser.clientUpdateTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th><@shiro.hasPermission name="imUser:view"><a class="btn btn-primary btn-sm" href="${ctx}/imUser/view/${imUser.id?c}" role="button" aria-pressed="true">详情</a></@shiro.hasPermission>
                        <@shiro.hasPermission name="imUser:edit"><a class="btn btn-info btn-sm" href="${ctx}/imUser/toEdit/${imUser.id?c}" role="button" aria-pressed="true">编辑</a></@shiro.hasPermission>
                    </th>
                </tr>
            </#list>
            </tbody>
        </table>

        <@Pagination.pagination formId="imUserForm"
            pageNo=imUsers.pageNo
            pageTotal=imUsers.pageTotal
            total=imUsers.total
            pageSize=imUsers.pageSize
            action="${ctx}/imUser/list">
        </@Pagination.pagination>
    </div>
</@body>

<@footer>
    <script src="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.full.min.js"></script>

    <script type="text/javascript">
        $(function () {
                $('#startLoginTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endLoginTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#startLockTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endLockTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#startCreateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endCreateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#startUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#startClientUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endClientUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
        });
    </script>

    <script src="${ctx}/resource/common/js/pagination.js"></script>
    <script src="${ctx}/resource/common/js/jquery.validate.min.js"></script>
</@footer>